/**
 * Extjs的简单代理
 */
(function() {
	Ext.onReady(function() {
		//创建model
		Ext.regModel('User', {
			feilds: [
				{name:'name', type:'string'},
				{name:'age', type:'int'}
				]
		});
		
		//不用create方法，直接用代理来创建对象数据
		var userData = [
			{name: 'zhangsan', age:100},
			{name: 'lisi', age:29},
			{name: 'wangwu', age:49}
			];
		
		//创建model的代理类
		var memoryProxy = Ext.create('Ext.data.proxy.Memory', {
			data:userData,
			model:'User'
		});
		
		//CRUD操作
		memoryProxy.read(new Ext.data.Operation(), function(result) {
			//alert(result.toString());
			var datas = result.resultSet.records;
			Ext.Array.each(datas, function(model) {
				alert(model.get('age'));
			});
		});
	});
})();